@echo off
setlocal enabledelayedexpansion

call mvn smart-doc:rpc-markdown

echo Docs

set rootPath=%cd%
set apiPath=%cd%\docs\api

for /d %%a in (*-client-grpc) do (

 cd %%a
 for /d %%b in (target) do (
     cd %%b
     for /d %%c in (rpc) do (
        echo %%c\grpc.md
        echo %apiPath%\grpc.md
        copy %%c\grpc.md %apiPath%\grpc.md /Y
     )
  )
)

echo %rootPath%
cd %rootPath%

for /d %%a in (*-client-http) do (
 cd %%a
 for /d %%b in (target) do (
     cd %%b
     for /d %%c in (rpc) do (
        echo %%c\http.md
        echo %apiPath%\http.md
        copy %%c\http.md %apiPath%\http.md /Y
     )
  )
)

cd %rootPath%

call mvn smart-doc:markdown

echo Markdown执行完成后，会自动复制target 下面的 md 文件到 docs 相应目录

echo %rootPath%
cd %rootPath%

for /d %%a in (*-restful) do (
 cd %%a
 for /d %%b in (target) do (
     cd %%b
     copy restful.md %apiPath%\restful.md /Y
  )
)

cd %rootPath%

pause

